package com.bafa.front.postlogon;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.bafa.exceptions.ErrorException;
import com.bafa.front.DaddyServlet;
import com.bafa.objects.Message;
import com.bafa.services.UserServices;
;

public class ChangePasswordServlet extends PostLogonServlet {

	@Override
	public void doPostLogonEvent(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ErrorException {
		message = new Message();
		HttpSession session = request.getSession();
		UserServices.changePassword(request.getParameter("user"),request.getParameter("oldpassword"),request.getParameter("password"));
		session.removeAttribute("LOGGEDON");
		message.addMessage("Password changed successfully");
		
		
	}
	
	
}
